<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 20064
  Date: 2020/2/16
  Time: 10:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>改签</title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 字体 -->
    <%--    <link href="https://fonts.font.im/css?family=Ruslan+Display" rel="stylesheet">--%>

    <!-- 图标 -->
    <link rel="icon" type="image/png" sizes="144x144" href="../images/airplane.png"/>
    <link rel="apple-touch-icon" type="image/png" sizes="144x144" href="../images/airplane.png"/>

    <!-- 其他 -->
    <link rel="stylesheet" href="../js/bootstrap-4.4.1-dist/css/bootstrap.min.css">

    <!-- js -->
    <script type="text/javascript" src="../js/jquery-3.4.1/jquery-3.4.1.js"></script>
</head>
<body>


<div class="container">
    <div class="row">
        <div class="card shadow w-100">
            <div class="card-header">
                <h2>航班列表</h2>
            </div>
            <div class="card-body">
                <table class="table table-hover text-center">
                    <thead>
                    <tr>
                        <th>航班ID</th>
                        <th>出发地</th>
                        <th>&nbsp;</th>
                        <th>目的地</th>
                        <th>出发时间</th>
                        <th>到达时间</th>
                        <th>&nbsp;</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:if test="${flightList == null || flightList.size() == 0}">
                        <tr>
                            <td colspan="7">暂时没有可以改签的航班</td>
                        </tr>
                    </c:if>
                    <c:forEach items="${flightList}" var="flight">
                        <tr>
                            <td>${flight.flightId}</td>
                            <td>${flight.flightStartArea.cityName}</td>
                            <td>-></td>
                            <td>${flight.flightEndArea.cityName}</td>
                            <td>${flight.flightStartTime}</td>
                            <td>${flight.flightEndTime}</td>
                            <td>
                                <button class="btn btn-info" type="button"
                                        onclick="changeFlight(${flight.flightId},${expenseId})">
                                    改签
                                </button>
                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
            <div class="card-footer">
                <div class="w-100 ">
                    <button class="btn btn-warning text-white float-right" type="button" onclick="goBack()">返回</button>
                </div>
            </div>

        </div>
    </div>

</div>

</body>
<script type="text/javascript" src="../js/bootstrap-4.4.1-dist/js/bootstrap.min.js"></script>
<script type="text/javascript">
    function goBack() {
        location.href = "getAllExpense.do";
    }

    function changeFlight(flightId, expenseId) {
        location.href = "changeExpenseFlight.do?flightId=" + flightId + "&expenseId=" + expenseId;
    }

</script>
</html>
